package com.adt.studioms.om;

import java.util.Date;

public class PaymentTx extends Transaction<PaymentTxDetail> {
    Long paymentDate;
    String payer;
    String receiptNumber;
    Long receiptDate;
    
    public PaymentTx() {
        super();
        
        paymentDate = System.currentTimeMillis();
        receiptDate = System.currentTimeMillis();
    }
    
    public String getType() {
        return PAYMENT;
    }

    public PaymentTxDetail createDetail() {
        PaymentTxDetail detail = new PaymentTxDetail();
        addDetail(detail);
        return detail;
    }

    public Long getPaymentDate() {
        return paymentDate;
    }
    
    public Date getFormattedPaymentDate() {
        return paymentDate!=null ? new Date(paymentDate) : null;
    }
    
    public void setPaymentDate(Long date) {
        paymentDate = date;;
    }
    
    public String getPayer() {
        return payer;
    }

    public void setPayer(String payer) {
        this.payer = payer;
    }

    public String getReceiptNumber() {
        return receiptNumber;
    }

    public void setReceiptNumber(String receiptNumber) {
        this.receiptNumber = receiptNumber;
    }

    public Long getReceiptDate() {
        return receiptDate;
    }
    
    public Date getFormattedReceiptDate() {
        return receiptDate!=null ? new Date(receiptDate) : null;
    }

    public void setReceiptDate(Long receiptDate) {
        this.receiptDate = receiptDate;
    }
    
    public PaymentTxDetail getDetail() {
        return details.size()>0 ? details.get(0) : null;
    }
}
